{extend name="base" /}
{block name="body"}
<div class="layui-card">
    <table class="layui-table" id="tableTrack" lay-filter="tableTrack"></table>
    <!-- 表格状态列 -->
    <script type="text/html" id="demoEDStateBar1">
        {{# if(d.subscribe==0){ }}
        <button class="layui-btn layui-btn-xs layui-btn-primary">未关注</button>
        {{# }else if(d.subscribe==1){ }}
        <button class="layui-btn layui-btn-xs layui-btn-normal">已关注</button>
        {{# } }}
    </script>
    <!-- 表格状态列 -->
    <script type="text/html" id="status">
        {{# if(d.status == 1){ }}
        <a class="layui-btn layui-btn-xs layui-btn-primary ajax-detail">已发送</a>
        {{# }else{ }}
        <a class="layui-btn layui-btn-sm">待发送</a>
        {{# } }}
    </script>
</div>
{/block}
{block name="js"}
<script>
    layui.use(['layer', 'form', 'table', 'util', 'dropdown'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        var table = layui.table;
        var util = layui.util;
        var admin = layui.admin;
        var dropdown = layui.dropdown;

        // 渲染回访表格
        var insTb = table.render({
            elem: '#tableTrack',
            url: "{:url('wechat/template/task_json')}",
            where:{
                id:"{:input('id')}"
            },
            page: true,
            limit:10,
            limits:[10,30,50,100,200,500,1000],
            loading:true,
            //totalRow: true,
            cols: [[
                {type: 'numbers', title: '序号'},
                {field: 'nickname', align: 'center', sort: true, title: '用户昵称'},
                {templet: '#status', align: 'left', title: '状态'},
                {field: 'error', align: 'center', sort: true, title: '发送反馈'}
            ]],
            parseData: function(res){ //res 即为原始返回的数据
                console.log(res)
                return {
                  "code": res.code, //解析接口状态
                  "msg": res.msg, //解析提示文本
                  "count": res.data.total, //解析数据长度
                  "data": res.data.data //解析数据列表
                };
            }
        });
        
    });
</script>
{/block}